package com.yule.system.home;

import com.yule.system.dao.CorpInfoDao;
import com.yule.system.model.CorpInfo;
import com.yule.system.model.CorpInfoExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CorpInfoHome {

    @Autowired
    CorpInfoDao corpInfoDao;

    public List<CorpInfo> findAll(){
        List<CorpInfo> list = corpInfoDao.selectByExample(null);
        return list;
    }

    public List<CorpInfo> findList(CorpInfoExample corpInfoExample){
        List<CorpInfo> list = corpInfoDao.selectByExample(corpInfoExample);
        return list;
    }

    public CorpInfo findOne(int id){
        CorpInfo corpInfo = corpInfoDao.selectByPrimaryKey(id);
        return corpInfo;
    }

    public void update(CorpInfo corpInfo){
        corpInfoDao.updateByPrimaryKeySelective(corpInfo);
    }

    public void delete(int id){
        corpInfoDao.deleteByPrimaryKey(id);
    }

    public int save(CorpInfo model){
        int id = corpInfoDao.insertSelective(model);
        return id;
    }
}
